

jQuery(document).ready(function()
{
	
	$('#guardaComentario').click(function() {
		$.ajax({
			url : 'sendComment', // action to be perform 
			type : 'POST',
			data : {
				newCommnet : $("#insert_comment").val()
			},
			dataType : 'html',
			success : function(html) {
				
				llenarLog();
				
				$('#addComment').html(html);
			},
			error : function(xhr, ajaxOptions, thrownError) {
				alert('An error occurred! ' + thrownError);
			},
		});
	});


});

var llenarLog = function() {
	$.ajax({
		url : 'getLog', // action to be perform
		dataType : 'html',
		success : function(html) {
			$('#log').html(html); // set result.jsp output to leftDiv
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});
 };